#pragma once
#include <iostream>
#include <string>


class TimeStamp {
	int year;
	int month;
	int day;
	int hour;
	int min;
	int sec;

	void Assign(const std::string& str);
public:
	enum Exceptions {LENGTH, CHAR, MONTH, DAY, HOUR, MIN, SEC};

	TimeStamp(const std::string& str="00000101000000");

	TimeStamp StepByHours(const int& hours);

	const int& Year()  const { return year; }
	const int& Month() const { return month; }
	const int& Day()   const { return day; }
	const int& Hour()  const { return hour; }
	const int& Min()   const { return min; }
	const int& Sec()   const { return sec; }

	int OneStr() const { return year + month + day + hour + min + sec; }

	friend std::ostream& operator<<(std::ostream& os, const TimeStamp& ts);
	friend std::istream& operator>>(std::istream& is, TimeStamp& ts);
};

	   bool operator< (const TimeStamp& ts1, const TimeStamp& ts2);
inline bool operator> (const TimeStamp& ts1, const TimeStamp& ts2){ return ts2 < ts1; }
inline bool operator==(const TimeStamp& ts1, const TimeStamp& ts2){ return !(ts2 < ts1 && ts1 < ts2); }
inline bool operator!=(const TimeStamp& ts1, const TimeStamp& ts2){ return ts1 < ts2 || ts2 < ts1; }
inline bool operator<=(const TimeStamp& ts1, const TimeStamp& ts2){ return !(ts2 < ts1); }
inline bool operator>=(const TimeStamp& ts1, const TimeStamp& ts2){ return !(ts1 < ts2); }